﻿using BCData.TMS.TrainingSite.TrainingSiteBusinessHours;
using BCDto.TMS.TrainingSite.TrainingSiteBusinessHours;
using BCService.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BCService.TMS.TrainingSite.TrainingSiteBusinessHours
{
    public class TrainingSiteBusinessHoursService : ITrainingSiteBusinessHoursService
    {
        private readonly ITrainingSiteBusinessHoursData trainingSiteBusinessHoursData;

        public TrainingSiteBusinessHoursService(ITrainingSiteBusinessHoursData trainingSiteBusinessHoursData)
        {
            this.trainingSiteBusinessHoursData = trainingSiteBusinessHoursData;
        }

        public IEnumerable<TrainingSiteBusinessHoursDto> GetList(long? trainingSiteConfigId, DateTime date)
        {
            var dayOfWeek = date.DayOfWeek;
            var result = this.trainingSiteBusinessHoursData.GetList(dayOfWeek, trainingSiteConfigId).Result;
            return result.As<IEnumerable<TrainingSiteBusinessHoursDto>>();
        }
    }
}
